import Base from "./base";

const api = new Base();

export const addGoods = (data: GoodsPatchData): Promise<string> =>
  api.postForm("/goods", data);

export const updateGoodsVisible = (
  goodsId: number,
  isShow: number
): Promise<string> => api.patch(`/goods/isShow/${goodsId}/${isShow}`);

export const getGoodsList = (
  data: PageFilter
): Promise<PageResult<GoodsItem>> => api.get("/goods/list", data);

export const delGoods = (goodsId: number): Promise<string> =>
  api.delete(`/goods/${goodsId}`);

export const updateGoods = (
  goodsId: number,
  data: GoodsPatchData
): Promise<string> => api.patchForm(`/goods/${goodsId}`, data);
